import Vue from "vue";
import VueRouter from "vue-router";
import dynamicRoutes from "./dynamicRoutes"

Vue.use(VueRouter);
//vue-router重写push方法，解决相同路径跳转报错
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => {
    console.log(err)
  })
}

const routes = [

  {
    path: "/login",
    name: "Login",
    component: () => import(/* webpackChunkName: "login" */"../views/Login"),
  },
  ...dynamicRoutes
];

const router = new VueRouter({
  routes,

});

export default router;
